﻿//======================================================================
//
//        Copyright (C) 苏州逸仙软件    
//        All rights reserved
//
//        filename : PulbicQuery.cs
//        description :
//
//        created by 周济 at 2010/12/31 14:00:42
//        mail:80406241@qq.com
//
//======================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace huaguwang
{
    public partial class PulbicQuery : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //           {
            //query:'Li',
            //suggestions:['Liberia','Libyan Arab Jamahiriya','Liechtenstein','Lithuania'],
            //data:['LR','LY','LI','LT']
            //}

            var str = Request.Params["query"].Exp_Trim();


            List<string> ss = new List<string>();
            for(int i = 0; i < 100; i++)
            {
                ss.Add("周济" + i.ToString());
            }

            var js = new huaguwang.Common.Json.JsonWriter();
            js.WriteObjectStart();
            js.WritePropertyName("query");
            js.Write(str);
            //js.WriteObjectEnd();
            //js.WriteObjectStart();
            js.WritePropertyName("suggestions");
            js.WriteArrayStart();
            foreach(var item in ss)
            {
                js.Write(item);
            }
            js.WriteArrayEnd();
            js.WriteObjectEnd();
            Response.Clear();
            Response.Write(js.ToString());
            Response.End();
        }
    }
}
